﻿@{
    ViewBag.Title = "学院、专业管理";
    Layout = "~/Views/Shared/_TreeLayout.cshtml";
}

<!--树-->


<!--Operation-->
<div class="heading-buttons">


    <div class="col-xs-12 col-sm-7 col-md-7 col-lg-4">
        <h1 class="page-title txt-color-blueDark"><i class="fa fa-pencil "></i>
            学院/专业管理
			
        </h1>
    </div>
    <div class="buttons pull-right">

        <button type="button" class="btn btn-success btn-labeled " id="btnDeanCollegeAdd"
            data-bind="click: $root.AddNewNode">
            <span class="btn-label"><i class="glyphicon glyphicon-plus"></i>
            </span>添加结点</button>

        <button type="button" class="btn btn-primary btn-labeled " id="btnDeanCollegeDel"
            data-bind="click: $root.DelNode">
            <span class="btn-label"><i class="glyphicon glyphicon-remove"></i>
            </span>删除结点</button>
    </div>
    <div style="clear: both;">
    </div>
</div>
<!--/Operation-->


<hr class="separator" />
<!-- Bread crumb is created dynamically -->



<div class="row">

    <div class="col-sm-6" style="margin-bottom: 5px; margin-top: 5px;">
        <div class="well well-light well-sm no-margin no-padding treeContent">
            <!--DeanCollege tree-->
            <ul id="DeanCollegeTree" class="ztree">
            </ul>


        </div>

    </div>
    <!-- end col-sm-61 -->
    <!--/DeanCollege tree-->







    <!--DeanCollege  information-->
    <div class="col-sm-6" style="margin-bottom: 5px; margin-top: 5px;">
        <div class="well well-light well-sm no-margin no-padding treeContent">
            <input type="hidden" id="hidId" />
            <form class="form-horizontal" id="frmDeanCollege" data-bind="with: NodeValue">

                <fieldset>
                    <div class="row" style="border-bottom: dashed 1px; margin-bottom: 10px;">
                        <h3 style="padding: 10px 0 10px 10px; float: left;"><strong>详细信息</strong></h3>
                        <div class="buttons pull-right">


                            <button type="button" id="btnDeanCollegeUpdate" class="btn btn-success btn-labeled " style="margin-top: 5px;" data-bind="click: $root.updateNode">
                                <span class="btn-label"><i class="fa fa-save"></i>
                                </span>保存</button>

                        </div>
                    </div>

                    <div style="clear: both;" />



                    <div class='form-group'>
                        <label class='col-md-2 control-label' style='margin-bottom: 3px;'>学院/专业名:</label>
                        <div class='col-md-9'>
                            <input type='text' id='txtbSCollegeName' name='txtbSCollegeName' placeholder='' class='form-control' data-bind='value:SCollegeName' />
                        </div>
                    </div>
                    <div class='form-group'>
                        <label class='col-md-2 control-label' style='margin-bottom: 3px;'>编号:</label>
                        <div class='col-md-9'>
                            <input type='text' id='txtbSCollegeCode' name='txtbSCollegeCode' placeholder='' class='form-control' data-bind='value:SCollegeCode' />
                        </div>
                    </div>


                    <input type='hidden' id='txtbIParentId' name='txtbIParentId' placeholder='' class='form-control' data-bind='value:IParentId' />

                    <div class='form-group'>
                        <label class='col-md-2 control-label' style='margin-bottom: 3px;'>备注:</label>
                        <div class='col-md-9'>
                            <input type='text' id='txtbSIntroduce' name='txtbSIntroduce' placeholder='' class='form-control' data-bind='value:SIntroduce' />
                        </div>
                    </div>

                    <input type='hidden' id='txtbILevel' name='txtbILevel' placeholder='' class='form-control' data-bind='value:ILevel' />


                </fieldset>

            </form>



        </div>
    </div>


</div>






<!-- end row -->
<!--/DeanCollege information-->


<script type="text/javascript">

    var viewModel;
    $(function () {


        var options = {

            renderDiv: $("#DeanCollegeTree"),
            hidId: $("#hidId"),
            frmElement: $("#frmDeanCollege"),



            UpdateBtn: $("#btnDeanCollegeUpdate"),
            AddBtn: $("#btnDeanCollegeAdd"),
            DelBtn: $("#btnDeanCollegeDel"),


            //节点数据
            NodeValue: ko.observable({

                Id: 0, SCollegeName: '', SCollegeCode: '', IParentId: 0, SIntroduce: '', ILevel: 0

            }),

            //用户查询URL
            dataQueryUrlAccessor: function () { return "/api/DeanCollege/TreeAll"; },

            //添加用户URL
            dataAddUrlAccessor: function (key) { return "/api/DeanCollege/AddTreeNode/" + key; },
            dataUpdateAccessor: function (key) { return "/api/DeanCollege/Put/" + key; },
            dataDeleteAccessor: function (key) {


                return "/api/DeanCollege/Delete/" + key;

            },
            dataNodeSelect: function (id) {
                return "/api/DeanCollege/get/" + id;
            }

			, showDlgBefore: function () {
			    //显示对话框之前

			}
                , showDetailEnd: function (data) {


                }
             , changeEnd: function (key, event) {
                 //对话框保存的后置事件
             }, initEd: function () {
                 //gird初始化的后置事件 信息

             }

        };

        viewModel = new ViewModel(options);


        viewModel.init();
        ko.applyBindings(viewModel);




        options.frmElement.validate({
            rules: {


                txtbId: { required: true, digits: true }, txtbSCollegeName: { required: true, maxlength: 50 }, txtbSCollegeCode: { required: true, maxlength: 50 }, txtbIParentId: { digits: true }, txtbSIntroduce: { maxlength: 50 }, txtbILevel: { digits: true }



            },
            messages: {


                txtbId: { required: '必填项', digits: '必须是整数' }, txtbSCollegeName: { required: "请填写名称", maxlength: '最大长度为20' }, txtbSCollegeCode: { required: "请填写编号", maxlength: '最大长度为50' }, txtbIParentId: { digits: '必须是整数' }, txtbSIntroduce: { maxlength: '最大长度为-1' }, txtbILevel: { digits: '必须是整数' }

            }
        });

    });

</script>




<!--end 树code-->


